import {baseRequest} from '@/utils/request'

const request = (url, ...arg) => baseRequest(`/bi/goals/monthly/` + url, ...arg)
const requestAdvance = (url, ...arg) => baseRequest(`/bi/goals/advance/` + url, ...arg)
export default {
	pageList(data) {
		return request('pageList', data, 'post')
	},
	list(data) {
		return request('list/' + data, '', 'get')
	},
	add(data) {
		return request('add', data, 'post')
	},
	edit(data) {
		return request('edit', data, 'post')
	},
	getChartData(id) {
		return request('getChartData/' + id, '', 'get')
	},
	// 获取垫付金额分页
	advancePaymentsPage(data) {
		return requestAdvance('page', data, 'get')
	},
	// 提交垫付金额表单 edit为true时为编辑，默认为新增
	advancePaymentsSubmitForm(data, edit = false) {
		return requestAdvance(edit ? 'edit' : 'add', data)
	},
	// 删除垫付金额
	advancePaymentsDelete(data) {
		return requestAdvance('delete', data)
	},
	// 获取垫付金额详情
	advancePaymentsDetail(data) {
		return requestAdvance('detail', data, 'get')
	},
	import(data, val) {
		return requestAdvance('import?val=' + val, data)
	},
	addRetaio(data,id) {
		return request('addRetaio?id='+id, data)
	},
	initializeApi(data){
		return request('initialize',data)
	},
	pageListRatio(data){
		return request('pageListRatio',data)
	}
}
